using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Logistica;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DALogistica;

namespace GC2.Bussines.BMLogistica
{
    public class BMCombustible
    {
        public BMCombustible(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Combustible oCombustible = new Combustible();
        private List<Combustible> listacombustibles = new List<Combustible>();
        private DACombustible daCombustible = new DACombustible();

        #region BMCombustibleInsert
        public void BMCombustibleInsert(Combustible combustible)
        {
            try
            {
                combustible = daCombustible.DACombustibleProximo(Connection, combustible);

                daCombustible.DACombustibleInsert(Connection, combustible);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCombustibleGetAll
        public List<Combustible> BMCombustibleGetAll(Combustible combustibleD, Combustible combustibleH)
        {
            try
            {
                listacombustibles = daCombustible.DACombustibleGetAll(Connection, combustibleD, combustibleH);
                return listacombustibles;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMCombustibleGetAllByPatente
        public List<Combustible> BMCombustibleGetAllByPatente(Combustible combustibleD, Combustible combustibleH)
        {
            try
            {
                listacombustibles = daCombustible.DACombustibleGetAllByPatente(Connection, combustibleD, combustibleH);
                return listacombustibles;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}

